{* Smarty *}
{extends file="include/base_with_menu.tpl"}

{block name="external_javascript"}
<script type="text/javascript" src="/scripts/jquery-ui/jquery.ui.datepicker-zh-CN.js"></script>
<script type="text/javascript" src="/scripts/oa_calendar.js"></script>
{/block}

{block name="javascript"}
<script type="text/javascript">
(function($) {
    $(function() {
        $('#last_maintain_date, #birthday').datepicker();
        $('#submit_button').click(function() {
            $value = $('input[name=bank_account]').val().replace(/\s+/g, '');
            $('input[name=bank_account]').val($value);
            $('#add_form').submit();
        });
    });
})(jQuery);
</script>
{/block}

{block name="content"}
<form id='add_form' method="post" action="/market/pr/school/teacher/edit">
<h3 class="blockTitle">教师--基本信息</h3>
<div class="layout">
    <table width="100%" class="tbLayout01" cellspacing="0" cellpadding="0">
        <tr>
            <td width="110" class="textRight"><span class="cRed">*</span> 姓名:</td>
            <td class="textLeft">
                <input type="text" name="name" class="txt01" value="{$teacher.name|escape}" />
                <span class="cGreen">(2-4个汉字)</span>
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">性别:</td>
            <td class="textLeft">
                <input type="radio" name="gender" value="" checked="checked" />不详&nbsp;
            {foreach $gender_setting as $id => $title}
                <input type="radio" name="gender" value="{$id}" {if $teacher.gender !== NULL && $id == $teacher.gender}checked="checked"{/if} />{$title}&nbsp;
            {/foreach}
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">出生年月:</td>
            <td class="textLeft">
                <input type="text" id="birthday" name="birthday" class="txt01" value="{$teacher.birthday|default:''}" /> 
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">职务:</td>
            <td class="textLeft">
                <input type="text" class="txt01" name="job" value="{$teacher.job|default:''|escape}" />
                <span class="cGreen">(2-6个汉字)</span>
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">年级/班级:</td>
            <td class="textLeft">
                <select name="grade" class="txt01">
                    <option value="">--年级--</option>
            {for $year=2011 to 2040}
                    <option value="{$year}" {if $year == $teacher.grade}selected="selected"{/if}>{$year}</option>
            {/for}
                </select>
                &nbsp;&nbsp;
                <select name="class" class="txt01">
                    <option value="">--班级--</option>
            {for $class=1 to 40}
                    <option value="{$class}"{if $class == $teacher.class}selected="selected"{/if}>{$class}</option>
            {/for}
                </select>
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">班别:</td>
            <td class="textLeft">
                <select name="class_type" class="txt01">
                    <option value="">--班别--</option>
            {foreach $class_type as $id => $title}
                    <option value="{$id}" {if $id == $teacher.class_type}selected="selected"{/if}>{$title}</option>
            {/foreach}
                </select>
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">手机:</td>
            <td class="textLeft">
                <input type="text" class="txt01" name="mobile" value="{$teacher.mobile|default:''}" />
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">电话:</td>
            <td class="textLeft">
                <input type="text" class="txt01" name="telphone" value="{$teacher.telphone|default:''}" />
                <span class="cGreen">(格式: 02885414200)</span>
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">任课:</td>
            <td class="textLeft">
                <select class="txt01" name="discipline">
                    <option value="">--请选择--</option>
            {foreach $discipline_setting as $id => $title}
                    <option value="{$id}" {if $id == $teacher.discipline}selected="selected"{/if}>{$title}</option>
            {/foreach}
                </select>
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">已提成:</td>
            <td class="textLeft">
                <input type="text" class="txt01" name="deduct" value="{$teacher.deduct}"  />
                <span class="cGreen">(大于等于0的正整数，单位：元)</span>
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">等级:</td>
            <td class="textLeft">
                <select class="txt01" name="level">
            {for $level=1 to 6}
                    <option value="{$level}" {if $level == $teacher.level}selected="selected"{/if}>{$level}</option>
            {/for}
                </select>
            </td>
        </tr>
    </table>
</div>
<h3 class="blockTitle">教师--关系维护</h3>
<div class="layout">
    <table width="100%" class="tbLayout01" cellspacing="0" cellpadding="0">
        <tr>
            <td width="110" class="textRight">上次跟进日期:</td>
            <td class="textLeft">
                <input type="text" class="txt01" id="last_maintain_date" name="last_maintain_date" value="{$teacher_maintain.last_maintain_date|default:''}" />
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">生活/反馈短信:</td>
            <td class="textLeft">
                <input type="text" class="txt01" name="feedback" size="110" value="{$teacher_maintain.feedback|default:''|escape}" />
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">节日礼物:</td>
            <td class="textLeft">
                <input type="text" class="txt01" name="festival_gift" size="110" value="{$teacher_maintain.festival_gift|default:''|escape}" />
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">银行卡号:</td>
            <td class="textLeft">
                <input type="text" class="txt01" name="bank_account" value="{$teacher.bank_account|default:''}" />
                <span class="cGreen">(格式：0000 0000 0000 0000)</span>
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">营销联系人:</td>
            <td class="textLeft">
                <select class="txt01" name="contactor_id">
                    <option value="">--请选择--</option>
            {foreach $market_users as $user}
                    <option value="{$user.id}" {if $user.id == $teacher.contactor_id}selected="selected"{/if}>{$user.name|escape}({$user.username|escape})</option>
            {/foreach}
                </select>
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">片区负责人:</td>
            <td class="textLeft">
                <select class="txt01" name="area_manager_id">
                    <option value="">--请选择--</option>
            {foreach $market_users as $user}
                    <option value="{$user.id}" {if $user.id == $teacher.area_manager_id}selected="selected"{/if}>{$user.name|escape}({$user.username|escape})</option>
            {/foreach}
                </select>
            </td>
        </tr>
    </table>
</div>

<h3 class="blockTitle">教师--备注</h3>
<div class="layout">
    <table width="100%" class="tbLayout01" cellspacing="0" cellpadding="0">
    {foreach $comments as $comment}
        <tr>
            <td width="110" class="textRight">&nbsp;</td>
            <td class="textLeft">
                <area class="txt01">
                    <p>{$comment.dateline|date_format:"%Y-%m-%d %H:%M:%S"}&nbsp;{$comment.name|escape}({$comment.u_id})</p>
                    <p>{$comment.comment|escape}</p>
        {if ! $comment@last}
                    <p>--------------------------------------------------------------------------------------------</p>
        {/if}
                </area>
            </td>
        </tr>
    {foreachelse}
        <tr>
            <td width="110" class="textRight">&nbsp;</td>
            <td class="textLeft"><span class="cGreen">该教师尚无备注</span></td>
        </tr>
    {/foreach}
    </table> 
</div>

<h3 class="blockTitle">教师--新增备注</h3>
<div class="layout">
    <table width="100%" class="tbLayout01" cellspacing="0" cellpadding="0">
        <tr>
            <td width="110" class="textRight">&nbsp;</td>
            <td class="textLeft">
                <textarea class="txt01" name="comment" cols="80" rows="5"></textarea>
                <br />
                <span class="cGreen">(字数限制为300个字)</span>
            </td>
        </tr>
        <tr>
            <td width="110" class="textRight">&nbsp;</td>
            <td class="textLeft">
                <input type="button" id="submit_button" value="提 交" />&nbsp;&nbsp;
                <input type="button" value="取 消" onclick="javascript:window.history.back();" />
            </td>
        </tr>
    </table>
    <input type="hidden" name="teacher_id" value="{$teacher.id}" />
    <input type="hidden" name="{$token_name|escape}" value="{$token_hash}" />
    <input type="hidden" name="return_url" value="{$return_url|default:''}" />
</div>
</form>
{/block}
